<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        div {
            width: 300px;
            height: 400px;
            border: 1px solid rgb(2, 5, 16);
            margin: 150px auto;
            border-radius: 5px;
            display: flex;
            flex-wrap: nowrap;
            align-items: center;
            flex-direction: column;
            background-color: rgba(254, 253, 255, 0.5);
        }

        #phone {
            height: 30px;
            width: 200px;
            margin-top: 50px;
            background-color: transparent;
        }

        #password {
            height: 30px;
            width: 100px;
            background-color: transparent;
        }

        button {
            width: 100px;
            height: 30px;
        }

        h2 {
            margin-top: 30px;
        }

        .box2 {
            width: 200px;
            height: 30px;
            display: flex;
            justify-content: space-between;
            flex-direction: row;
        }
    </style>
</head>

<body>
    <div>
        <h2>登录</h2>
        <input type="text" name="" id="phone" placeholder="手机号"><br>
        <div class="box2">
            <input type="password" id="password" placeholder="验证码">
            <button onclick="fs()">发送验证码</button>
        </div>
        <button onclick="dl()">登录</button>
    </div>

    <script src="./jquery-1.8.3.min.js"></script>
    <script>

        var but = document.querySelector("button");
        var time = 59;
        function fs() {
            var timer = setInterval(function () {
                if (time == 0) {
                    clearInterval(timer);
                    time = 10;
                    but.innerHTML = "发送"
                } else {
                    but.innerHTML = "剩余" + time + "秒";
                    time--;
                }
            }, 1000)

            $.ajax({
                url: "http://43.143.211.183:8889/sendSms/19335914366",
                type: "get",
                success(res) {
                    console.log(res);

                }

            })
        }
        function dl() {
            $.ajax({
                url:"http://43.143.211.183:8889/login/h5/with-phone-code",
                type:"post",
                data:JSON.stringify({
                    phone:$("#phone").val(),
                    phone_code:$("#password").val(),
                    invite_code:""
                }),
                contentType:'application/json',
                success(a){
                    console.log(a);
                    
                }

            })
        }



    </script>
</body>

</html>